home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: diskReceive.c,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:55:38 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "list.h"
- #include "tid.h"
- #include "io.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "disk.h"
- #include "thread.h"
- #include "semaphore.h"
- #include "latch.h"
- #include "link.h"
- #include "bf.h"
- #include "volume.h"
- #include "pool.h"
- #include "io_globals.h"
- #include "threadstate.h"
- #include "disk_funcs.h"
- #include "thread_funcs.h"
- #include "thread_globals.h"
- #include "queue_consist.h"
-
-
- /*
- * note that if an error is generated here then it will be
- * passed to all waiters but the link will not be called
- */
-
-
-
- void
- diskReceive (
- register LINK *link
- )
-
- {
- register int bytesRead;
- char volumenumber = 0xff;
- extern int disk_replies_kicked;
- extern int unnecessary_kicks;
-
- disk_replies_kicked++;
-
- /*
- * just read the disk queue# from the disk process
- */
- if((bytesRead =
- read(link->id, (caddr_t)(&volumenumber), sizeof(volumenumber))) <= 0) {
- if(bytesRead==0)
- errno = esmDISKPROCDIED;
-
- SM_ERROR(TYPE_STOP, errno); /* don't dump core because
- that would overwrite the core file for the disk proc,
- which we then would be unable to debug.
-
- BTW: what's below is really unreachable
- since TYPE_STOP exits.
- Keep the code in here though, in case we decide to
- do something else instead of stop.
- */
- freeDiskLink(link, esmFAILURE, errno);
- threadRestart();
- }
-
- diskReceiveQ( diskQueue((int)volumenumber), FALSE /* not holding mutex */);
-
- /*
- * we get here only if there's really nothing on this queue
- * (i.e., it already got processed), which would be an error
- * except that we might have caught some of the results
- * in selectDisk(), so we just ignore this kick.
- */
- unnecessary_kicks++;
- }
-